	<template>
	<view class="wrap">
		<u-navbar :title="$t('index.zcjl')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }"></u-navbar>
		<view class="tom-container">
			<view class="tab">
				<view class="item0" :class="tablistIndex == 0? 'item':''" @tap="tabPay(0)">{{$t('quanbu')}}</view>
				<view class="item1" :class="tablistIndex == 1? 'item':''" @tap="tabPay(1)">{{$t('zhichu')}}</view>
				<view class="item2" :class="tablistIndex == 2? 'item':''" @tap="tabPay(2)">{{$t('shouru')}}</view>
			</view>
			<view class="list">
				<mescroll-uni  :fixed="false" ref="mescrollRef"  @down="downCallback" @up="upCallback">
					<view class="list_nr_li" v-for="(item,index) in list" :key="index">
						<view class="left">
							<view class="text1">{{item.remark}}</view>
							<view class="text2">{{$t('yonghu')}}：{{item.userStr}}</view>
						</view>
						<view class="right">
							<view class="text1">{{item.createDate}}</view>
							<view class="text2" :class="{'active':item.changeType == 2}">{{item.changeQuantity}}</view>
						</view>
					</view>
				</mescroll-uni>
			</view>
		</view>
	</view>
</template>

<script>
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
	mixins: [MescrollMixin],
	data() {
		return {
			tablistIndex:0,
			list:[]
		};
	},
	methods: {
		tabPay(info){
			this.tablistIndex = info;
			this.mescroll.resetUpScroll()
		},
		// 下拉刷新
		downCallback(){
			this.mescroll.resetUpScroll()
		},
		// 上拉加载
		upCallback(page){
			uni.showLoading({
				mask: true,
				title: this.$t('loading.title')
			});
			this.$api.userApi
				.getMyAssetChangeLogList({
					page:page.num,
					pageSize:20,
					changeType:this.tablistIndex,
				})
				.then(res => {
					// this.pageData = res.data;
					let list=res.data || [];
					this.mescroll.endSuccess(list.length)
					if(page.num == 1) this.list = []; //如果是第一页需手动制空列表
					this.list=this.list.concat(list); //追加新数据
					uni.hideLoading();
				}).catch(res =>{
					uni.hideLoading();
				})
		},
	}
};
</script>

<style lang="scss" scoped>
.tom-container {
	padding-top: 30rpx;
	// overflow: hidden;
}
.tab{
	height: 80rpx;
	border: 2rpx solid $tom-text-sub-color3;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0rpx $nr-padd  40rpx $nr-padd;
	box-sizing: border-box;
	border-radius:10rpx ;
	background-color: #fff;
	.item0{
		position: relative;
		left: -2rpx;
		width: 100%;height: 80rpx;
		color: $tom-text-sub-color;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		border-radius:10rpx ;
		border:  2rpx solid transparent;
	}
	.item1{
		width: 100%;height: 80rpx;
		color: $tom-text-sub-color;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		border-radius:10rpx ;
		border:  2rpx solid transparent;
	}
	.item2{
		position: relative;
		right: -2rpx;
		width: 100%;height: 80rpx;
		color: $tom-text-sub-color;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		border-radius:10rpx ;
		border:  2rpx solid transparent;
	}
	.item{
		color: #fff;
		border:  2rpx solid $text-color;
		background-color: $text-color;
	}
}
.list {
	background-color: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: auto;
	border-radius: 50rpx 50rpx 0rpx 0rpx;
	background-image: url('/static/new_images/showPopup.png');
	background-position: left bottom;
	background-repeat: no-repeat;
	background-size: 100% 800rpx;
	.list_nr_li {
		color: $tom-text-color;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 22rpx $nr-padd;
		border-bottom: 2rpx solid $page-bg;
		.left {
			.text1 {
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 18rpx;
			}
			.text2 {
				font-size: 24rpx;
				color: $tom-text-sub-color2;
			}
		}
		.right {
			text-align: right;
			.text1 {
				font-size: 24rpx;
				margin-bottom: 18rpx;
				color: $tom-text-sub-color2;
			}
			.text2 {
				font-size: 28rpx;
				color: $tom-text-red;
				font-weight: bold;
			}
			.active{
				color: $tom-text-green;
				border-color: $tom-text-green;
			}
		}
	}
}
</style>
